# from django.contrib.auth.models import User, Permission
from django.db import models
from django.contrib.auth.models import AbstractUser


class UserInfo(models.Model):
    username = models.CharField(max_length=256, blank=True, null=True)
    secret_key = models.CharField(max_length=256, blank=True, null=True)
    phonenumber = models.CharField(max_length=256, blank=True, null=True)
    permission = models.CharField(max_length=256, blank=True, null=True)
    login = models.BooleanField(default=True)
    email = models.CharField(max_length=256, blank=True, null=True)
    cardid = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'userinfo'

class allmenus(models.Model):
    menus = models.CharField(max_length=256, blank=True, null=True)
    menusid = models.CharField(max_length=256, blank=True, null=True)
    grade = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'allmenus'

class rolename(models.Model):
    role = models.CharField(max_length=256, blank=True, null=True)
    rolegrade = models.CharField(max_length=256, blank=True, null=True)
    grade = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'rolename'

class rolemenus(models.Model):
    role = models.CharField(max_length=256, blank=True, null=True)
    id = models.IntegerField
    class Meta:
        db_table = 'rolemenus'

class router(models.Model):
    name = models.CharField(max_length=256, blank=True, null=True)
    component = models.CharField(max_length=256, blank=True, null=True)
    path = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'router'

class ApiGroupWorkflow(models.Model):
    user_id = models.CharField(max_length=256, blank=True, null=True)
    robot_id = models.CharField(max_length=256,blank=True, null=True)
    group_id = models.CharField(max_length=256,blank=True,null=True)
    workflow_id = models.CharField(max_length=256,blank=True,null=True)
    workflow_title = models.CharField(max_length=256,blank=True,null=True)
    workflow_content = models.CharField(max_length=1024,blank=True,null=True)
    status = models.CharField(max_length=1024,blank=True,null=True)
    class Meta:
        managed = False
        db_table = 'api_im_workflow_info'

class System_LoginPage(models.Model):
    system = models.CharField(max_length=256, blank=True, null=True)
    Login_Page = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'system_loginpage'

class UserInput(models.Model):
    type = models.CharField(max_length=256, blank=True, null=True)
    problem = models.TextField(blank=True, null=True)  # 用于存储问题文本
    Similarity_problem = models.TextField(blank=True, null=True)  # 用于存储相似问题文本
    answer = models.TextField(blank=True, null=True)  # 用于存储答案文本
    time = models.DateTimeField(auto_now=True)
    class Meta:
        db_table = 'userinput'

class UserInput_history(models.Model):
    movement = models.CharField(max_length=256, blank=True, null=True)
    time = models.DateTimeField(auto_now=True)
    Modify_field = models.CharField(max_length=256, blank=True, null=True)
    class Meta:
        db_table = 'userinput_history'

class st_data(models.Model):
    App = models.CharField(max_length=255)
    ID = models.CharField(max_length=255)
    Date = models.DateField()
    Area = models.CharField(max_length=255)
    Device = models.CharField(max_length=255)
    Downloads = models.IntegerField()
    Revenue = models.DecimalField(max_digits=10, decimal_places=2)
    scrape_time = models.DateTimeField()
    save_time = models.DateTimeField()
    class Meta:
        db_table = 'financial_st_data'

class dataai_data(models.Model):
    App = models.CharField(max_length=255)
    Date = models.DateField()
    Device = models.CharField(max_length=255)
    Downloads = models.IntegerField()
    AvgDownloads = models.IntegerField()
    CumulativeDownloads = models.IntegerField()
    DownloadsShare = models.FloatField()
    StoreRevenue = models.FloatField()
    AvgStoreRevenue = models.FloatField()
    CumulativeStoreRevenue = models.FloatField()
    StoreRevenueShare = models.FloatField()
    StoreRPD = models.FloatField()
    scrape_time = models.DateTimeField()
    save_time = models.DateTimeField()
    class Meta:
        db_table = 'financial_dataai_data'